/*
 * PROJECT:     ReactOS Display Driver Model
 * LICENSE:     MIT (https://spdx.org/licenses/MIT)
 * PURPOSE:     Dxgkrnl callbacks header
 * COPYRIGHT:   Copyright 2023 Justin Miller <justin.miller@reactos.org>
 */

#pragma once

#include <d3dkmddi.h>

/*
 * Every structure in here is shared across two or more modules and doesn't currently
 * match a single Windows version/update.
 *
 * These structures DO have variants in Windows, I just would like to track what
 * we don't match 1:1 yet. Or haven't bother attempting to do so.
 */

/* REACTOS_WIN32K_DXGKRNL_INTERFACE function Pointers: */

typedef
NTSTATUS
DXGADAPTER_CREATEALLOCATION(_Inout_ D3DKMT_CREATEALLOCATION* unnamedParam1);

typedef DXGADAPTER_CREATEALLOCATION *PDXGADAPTER_CREATEALLOCATION;

typedef
NTSTATUS
DXGADAPTER_CHECKMONITORPOWERSTATE(_In_ const D3DKMT_CHECKMONITORPOWERSTATE* unnamedParam1);

typedef DXGADAPTER_CHECKMONITORPOWERSTATE *PDXGADAPTER_CHECKMONITORPOWERSTATE;

typedef
NTSTATUS
DXGADAPTER_CHECKOCCLUSION(_In_ const D3DKMT_CHECKOCCLUSION* unnamedParam1);

typedef DXGADAPTER_CHECKOCCLUSION *PDXGADAPTER_CHECKOCCLUSION;

typedef
NTSTATUS
DXGADAPTER_CLOSEADAPTER(_In_ const D3DKMT_CLOSEADAPTER* unnamedParam1);

typedef DXGADAPTER_CLOSEADAPTER *PDXGADAPTER_CLOSEADAPTER;

typedef
NTSTATUS
DXGADAPTER_CREATECONTEXT(_Inout_ const D3DKMT_CREATECONTEXT* unnamedParam1);

typedef DXGADAPTER_CREATECONTEXT *PDXGADAPTER_CREATECONTEXT;

typedef
NTSTATUS
DXGADAPTER_CREATEDEVICE(_Inout_ const D3DKMT_CREATEDEVICE* unnamedParam1);

typedef DXGADAPTER_CREATEDEVICE *PDXGADAPTER_CREATEDEVICE;

typedef
NTSTATUS
DXGADAPTER_CREATEOVERLAY(_Inout_ const D3DKMT_CREATEOVERLAY* unnamedParam1);

typedef DXGADAPTER_CREATEOVERLAY *PDXGADAPTER_CREATEOVERLAY;

typedef
NTSTATUS
DXGADAPTER_CREATESYNCHRONIZATIONOBJECT(_Inout_ const D3DKMT_CREATESYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_CREATESYNCHRONIZATIONOBJECT *PDXGADAPTER_CREATESYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_DESTROYALLOCATION(_In_ const D3DKMT_DESTROYALLOCATION* unnamedParam1);

typedef DXGADAPTER_DESTROYALLOCATION *PDXGADAPTER_DESTROYALLOCATION;

typedef
NTSTATUS
DXGADAPTER_DESTROYCONTEXT(_In_ const D3DKMT_DESTROYCONTEXT* unnamedParam1);

typedef DXGADAPTER_DESTROYCONTEXT *PDXGADAPTER_DESTROYCONTEXT;

typedef
NTSTATUS
DXGADAPTER_DESTROYDEVICE(_In_ const D3DKMT_DESTROYDEVICE* unnamedParam1);

typedef DXGADAPTER_DESTROYDEVICE *PDXGADAPTER_DESTROYDEVICE;

typedef
NTSTATUS
DXGADAPTER_DESTROYOVERLAY(_In_ const D3DKMT_DESTROYOVERLAY* unnamedParam1);

typedef DXGADAPTER_DESTROYOVERLAY *PDXGADAPTER_DESTROYOVERLAY;

typedef
NTSTATUS
DXGADAPTER_DESTROYSYNCHRONIZATIONOBJECT(_In_ const D3DKMT_DESTROYSYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_DESTROYSYNCHRONIZATIONOBJECT *PDXGADAPTER_DESTROYSYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_ESCAPE(_In_ const D3DKMT_ESCAPE* unnamedParam1);

typedef DXGADAPTER_ESCAPE *PDXGADAPTER_ESCAPE;

typedef
NTSTATUS
DXGADAPTER_FLIPOVERLAY(_In_ const D3DKMT_FLIPOVERLAY* unnamedParam1);

typedef DXGADAPTER_FLIPOVERLAY *PDXGADAPTER_FLIPOVERLAY;

typedef
NTSTATUS
DXGADAPTER_GETCONTEXTSCHEDULINGPRIORITY(_Inout_ const D3DKMT_GETCONTEXTSCHEDULINGPRIORITY* unnamedParam1);

typedef DXGADAPTER_GETCONTEXTSCHEDULINGPRIORITY *PDXGADAPTER_GETCONTEXTSCHEDULINGPRIORITY;

typedef
NTSTATUS
DXGADAPTER_GETDEVICESTATE(_Inout_ D3DKMT_GETDEVICESTATE* unnamedParam1);

typedef DXGADAPTER_GETDEVICESTATE *PDXGADAPTER_GETDEVICESTATE;

typedef
NTSTATUS
DXGADAPTER_GETDISPLAYMODELIST(_Inout_ D3DKMT_GETDISPLAYMODELIST* unnamedParam1);

typedef DXGADAPTER_GETDISPLAYMODELIST *PDXGADAPTER_GETDISPLAYMODELIST;

typedef
NTSTATUS
DXGADAPTER_GETMULTISAMPLEMETHODLIST(_Inout_ D3DKMT_GETMULTISAMPLEMETHODLIST* unnamedParam1);

typedef DXGADAPTER_GETMULTISAMPLEMETHODLIST *PDXGADAPTER_GETMULTISAMPLEMETHODLIST;

typedef
NTSTATUS
DXGADAPTER_GETRUNTIMEDATA(_Inout_ const D3DKMT_GETRUNTIMEDATA* unnamedParam1);

typedef DXGADAPTER_GETRUNTIMEDATA *PDXGADAPTER_GETRUNTIMEDATA;

typedef
NTSTATUS
DXGADAPTER_GETSCANLINE(_Inout_ D3DKMT_GETSCANLINE* unnamedParam1);

typedef DXGADAPTER_GETSCANLINE *PDXGADAPTER_GETSCANLINE;

typedef
NTSTATUS
DXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT(_In_ const D3DKMT_SIGNALSYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT *PDXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_WAITFORVERTICALBLANKEVENT(_In_ const D3DKMT_WAITFORVERTICALBLANKEVENT* unnamedParam1);

typedef DXGADAPTER_WAITFORVERTICALBLANKEVENT *PDXGADAPTER_WAITFORVERTICALBLANKEVENT;

typedef
NTSTATUS
DXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT(_In_ const D3DKMT_WAITFORSYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT *PDXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_SETVIDPNSOURCEOWNER(_In_ const D3DKMT_SETVIDPNSOURCEOWNER* unnamedParam1);

typedef DXGADAPTER_SETVIDPNSOURCEOWNER *PDXGADAPTER_SETVIDPNSOURCEOWNER;

typedef
NTSTATUS
DXGADAPTER_WAITFORIDLE(_In_ const D3DKMT_WAITFORIDLE* unnamedParam1);

typedef DXGADAPTER_WAITFORIDLE *PDXGADAPTER_WAITFORIDLE;

typedef
NTSTATUS
DXGADAPTER_UPDATEOVERLAY(_In_ const D3DKMT_UPDATEOVERLAY* unnamedParam1);

typedef DXGADAPTER_UPDATEOVERLAY *PDXGADAPTER_UPDATEOVERLAY;

typedef
NTSTATUS
DXGADAPTER_SETQUEUEDLIMIT(_In_ const D3DKMT_SETQUEUEDLIMIT* unnamedParam1);

typedef DXGADAPTER_SETQUEUEDLIMIT *PDXGADAPTER_SETQUEUEDLIMIT;

typedef
NTSTATUS
DXGADAPTER_SETGAMMARAMP(_In_ const D3DKMT_SETGAMMARAMP* unnamedParam1);

typedef DXGADAPTER_SETGAMMARAMP *PDXGADAPTER_SETGAMMARAMP;

typedef
NTSTATUS
DXGADAPTER_SETDISPLAYMODE(_In_ const D3DKMT_SETDISPLAYMODE* unnamedParam1);

typedef DXGADAPTER_SETDISPLAYMODE *PDXGADAPTER_SETDISPLAYMODE;

typedef
NTSTATUS
DXGADAPTER_SETDISPLAYPRIVATEDRIVERFORMAT(_In_ const D3DKMT_SETDISPLAYPRIVATEDRIVERFORMAT* unnamedParam1);

typedef DXGADAPTER_SETDISPLAYPRIVATEDRIVERFORMAT *PDXGADAPTER_SETDISPLAYPRIVATEDRIVERFORMAT;


typedef
NTSTATUS
DXGADAPTER_SETGAMMARAMP(_In_ const D3DKMT_SETGAMMARAMP* unnamedParam1);

typedef DXGADAPTER_SETGAMMARAMP *PDXGADAPTER_SETGAMMARAMP;

typedef
NTSTATUS
DXGADAPTER_SETQUEUEDLIMIT(_In_ const D3DKMT_SETQUEUEDLIMIT* unnamedParam1);

typedef DXGADAPTER_SETQUEUEDLIMIT *PDXGADAPTER_SETQUEUEDLIMIT;

typedef
NTSTATUS
DXGADAPTER_SETVIDPNSOURCEOWNER(_In_ const D3DKMT_SETVIDPNSOURCEOWNER* unnamedParam1);

typedef DXGADAPTER_SETVIDPNSOURCEOWNER *PDXGADAPTER_SETVIDPNSOURCEOWNER;

typedef
NTSTATUS
DXGADAPTER_UNLOCK(_In_ const D3DKMT_UNLOCK* unnamedParam1);

typedef DXGADAPTER_UNLOCK *PDXGADAPTER_UNLOCK;

typedef
NTSTATUS
DXGADAPTER_UPDATEOVERLAY(_In_ const D3DKMT_UPDATEOVERLAY* unnamedParam1);

typedef DXGADAPTER_UPDATEOVERLAY *PDXGADAPTER_UPDATEOVERLAY;

typedef
NTSTATUS
DXGADAPTER_WAITFORIDLE(_In_ const D3DKMT_WAITFORIDLE* unnamedParam1);

typedef DXGADAPTER_WAITFORIDLE *PDXGADAPTER_WAITFORIDLE;

typedef
NTSTATUS
DXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT(_In_ const D3DKMT_WAITFORSYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT *PDXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_WAITFORVERTICALBLANKEVENT(_In_ const D3DKMT_WAITFORVERTICALBLANKEVENT* unnamedParam1);

typedef DXGADAPTER_WAITFORVERTICALBLANKEVENT *PDXGADAPTER_WAITFORVERTICALBLANKEVENT;

typedef
NTSTATUS
DXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT(_In_ const D3DKMT_SIGNALSYNCHRONIZATIONOBJECT* unnamedParam1);

typedef DXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT *PDXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT;

typedef
NTSTATUS
DXGADAPTER_QUERYRESOURCEINFO(_Inout_ D3DKMT_QUERYRESOURCEINFO* unnamedParam1);

typedef DXGADAPTER_QUERYRESOURCEINFO *PDXGADAPTER_QUERYRESOURCEINFO;

typedef
NTSTATUS
DXGADAPTER_GETPRESENTHISTORY(_Inout_ D3DKMT_GETPRESENTHISTORY* unnamedParam1);

typedef DXGADAPTER_GETPRESENTHISTORY *PDXGADAPTER_GETPRESENTHISTORY;

typedef
NTSTATUS
DXGADAPTER_SETALLOCATIONPRIORITY(_In_ const D3DKMT_SETALLOCATIONPRIORITY* unnamedParam1);

typedef DXGADAPTER_SETALLOCATIONPRIORITY *PDXGADAPTER_SETALLOCATIONPRIORITY;

typedef
NTSTATUS
DXGADAPTER_INVALIDATEACTIVEVIDPN(_In_ const D3DKMT_INVALIDATEACTIVEVIDPN* unnamedParam1);

typedef DXGADAPTER_INVALIDATEACTIVEVIDPN *PDXGADAPTER_INVALIDATEACTIVEVIDPN;

typedef
NTSTATUS
DXGADAPTER_GETSHAREDPRIMARYHANDLE(_In_ D3DKMT_GETSHAREDPRIMARYHANDLE* unnamedParam1);

typedef DXGADAPTER_GETSHAREDPRIMARYHANDLE *PDXGADAPTER_GETSHAREDPRIMARYHANDLE;

typedef
NTSTATUS
DXGADAPTER_LOCK(_In_ D3DKMT_LOCK* unnamedParam1);

typedef DXGADAPTER_LOCK *PDXGADAPTER_LOCK;

typedef
NTSTATUS
DXGADAPTER_POLLDISPLAYCHILDREN(_In_ const D3DKMT_POLLDISPLAYCHILDREN* unnamedParam1);

typedef DXGADAPTER_POLLDISPLAYCHILDREN *PDXGADAPTER_POLLDISPLAYCHILDREN;

typedef
NTSTATUS
DXGADAPTER_OPENRESOURCE(_Inout_ D3DKMT_OPENRESOURCE* unnamedParam1);

typedef DXGADAPTER_OPENRESOURCE *PDXGADAPTER_OPENRESOURCE;

typedef
NTSTATUS
DXGADAPTER_PRESENT(_In_ D3DKMT_PRESENT* unnamedParam1);

typedef DXGADAPTER_PRESENT *PDXGADAPTER_PRESENT;

typedef
NTSTATUS
DXGADAPTER_QUERYADAPTERINFO(_Inout_ const D3DKMT_QUERYADAPTERINFO* unnamedParam1);

typedef DXGADAPTER_QUERYADAPTERINFO *PDXGADAPTER_QUERYADAPTERINFO;

typedef
NTSTATUS
DXGADAPTER_QUERYALLOCATIONRESIDENCY(_In_ const D3DKMT_QUERYALLOCATIONRESIDENCY* unnamedParam1);

typedef DXGADAPTER_QUERYALLOCATIONRESIDENCY *PDXGADAPTER_QUERYALLOCATIONRESIDENCY;

typedef
NTSTATUS
DXGADAPTER_QUERYSTATISTICS(_Inout_ const D3DKMT_QUERYSTATISTICS* unnamedParam1);

typedef DXGADAPTER_QUERYSTATISTICS *PDXGADAPTER_QUERYSTATISTICS;

typedef
NTSTATUS
DXGADAPTER_RELEASEPROCESSVIDPNSOURCEOWNERS(_In_ HANDLE unnamedParam1);

typedef DXGADAPTER_RELEASEPROCESSVIDPNSOURCEOWNERS *PDXGADAPTER_RELEASEPROCESSVIDPNSOURCEOWNERS;

typedef
NTSTATUS
DXGADAPTER_RENDER(_In_ D3DKMT_RENDER* unnamedParam1);

typedef DXGADAPTER_RENDER *PDXGADAPTER_RENDER;

typedef
NTSTATUS
DXGADAPTER_SETCONTEXTSCHEDULINGPRIORITY(_In_ const D3DKMT_SETCONTEXTSCHEDULINGPRIORITY* unnamedParam1);

typedef DXGADAPTER_SETCONTEXTSCHEDULINGPRIORITY *PDXGADAPTER_SETCONTEXTSCHEDULINGPRIORITY;

/*
 * This structure is the callbacks list that exist between DXGKNRL and Win32k.
 * This private interface is undocumented and changes with every Windows update
 * that remotely touches WDDM.
 *
 * Reversing this isn't possible until we can throw our DxgKrnl into vista or above at runtime.
 * But this cannot happen without us first supporting watchdog.
 */
typedef struct _REACTOS_WIN32K_DXGKRNL_INTERFACE
{
    PDXGADAPTER_PRESENT RxgkIntPfnPresent;
    PDXGADAPTER_QUERYADAPTERINFO RxgkIntPfnQueryAdapterInfo;
    PDXGADAPTER_QUERYALLOCATIONRESIDENCY RxgkIntPfnQueryAllocationResidency;
    PDXGADAPTER_QUERYSTATISTICS RxgkIntPfnQueryStatistics;
    PDXGADAPTER_RELEASEPROCESSVIDPNSOURCEOWNERS RxgkIntPfnReleaseProcessVidPnSourceOwners;
    PDXGADAPTER_RENDER RxgkIntPfnRender;
    PDXGADAPTER_SETCONTEXTSCHEDULINGPRIORITY RxgkIntPfnSetContextSchedulingPriority;
    PDXGADAPTER_OPENRESOURCE RxgkIntPfnOpenResource;
    PDXGADAPTER_POLLDISPLAYCHILDREN RxgkIntPfnPollDisplayChildren;
    PDXGADAPTER_LOCK RxgkIntPfnLock;
    PDXGADAPTER_GETSHAREDPRIMARYHANDLE RxgkIntPfnGetSharedPrimaryHandle;
    PDXGADAPTER_INVALIDATEACTIVEVIDPN RxgkIntPfnInvalidateActiveVidPn;
    PDXGADAPTER_SETALLOCATIONPRIORITY RxgkIntPfnSetAllocationPriority;
    PDXGADAPTER_GETPRESENTHISTORY RxgkIntPfnGetPresentHistory;
    PDXGADAPTER_QUERYRESOURCEINFO RxgkIntPfnQueryResourceInfo;
    PDXGADAPTER_CREATEALLOCATION RxgkIntPfnCreateAllocation;
    PDXGADAPTER_CHECKMONITORPOWERSTATE RxgkIntPfnCheckMonitorPowerState;
    PDXGADAPTER_CHECKOCCLUSION RxgkIntPfnCheckOcclusion;
    PDXGADAPTER_CLOSEADAPTER RxgkIntPfnCloseAdapter;
    PDXGADAPTER_CREATECONTEXT RxgkIntPfnCreateContext;
    PDXGADAPTER_CREATEDEVICE RxgkIntPfnCreateDevice;
    PDXGADAPTER_CREATEOVERLAY RxgkIntPfnCreateOverlay;
    PDXGADAPTER_CREATESYNCHRONIZATIONOBJECT RxgkIntPfnCreateSynchronizationObject;
    PDXGADAPTER_DESTROYCONTEXT RxgkIntPfnDestroyContext;
    PDXGADAPTER_DESTROYDEVICE RxgkIntPfnDestroyDevice;
    PDXGADAPTER_DESTROYOVERLAY RxgkIntPfnDestroyOverlay;
    PDXGADAPTER_DESTROYSYNCHRONIZATIONOBJECT RxgkIntPfnDestroySynchronizationObject;
    PDXGADAPTER_ESCAPE RxgkIntPfnEscape;
    PDXGADAPTER_DESTROYALLOCATION RxgkIntPfnDestroyAllocation;
    PDXGADAPTER_FLIPOVERLAY RxgkIntPfnFlipOverlay;
    PDXGADAPTER_GETCONTEXTSCHEDULINGPRIORITY RxgkIntPfnGetContextSchedulingPriority;
    PDXGADAPTER_GETDEVICESTATE RxgkIntPfnGetDeviceState;
    PDXGADAPTER_GETDISPLAYMODELIST RxgkIntPfnGetDisplayModeList;
    PDXGADAPTER_GETMULTISAMPLEMETHODLIST RxgkIntPfnGetMultisampleMethodList;
    PDXGADAPTER_GETRUNTIMEDATA RxgkIntPfnGetRuntimeData;
    PDXGADAPTER_GETSCANLINE RxgkIntPfnGetScanLine;
    PDXGADAPTER_SIGNALSYNCHRONIZATIONOBJECT RxgkIntPfnSignalSynchronizationObject;
    PDXGADAPTER_WAITFORVERTICALBLANKEVENT RxgkIntPfnWaitForVerticalBlankEvent;
    PDXGADAPTER_WAITFORSYNCHRONIZATIONOBJECT RxgkIntPfnWaitForSynchronizationObject;
    PDXGADAPTER_SETVIDPNSOURCEOWNER RxgkIntPfnSetVidPnSourceOwner;
    PDXGADAPTER_WAITFORIDLE RxgkIntPfnWaitForIdle;
    PDXGADAPTER_UPDATEOVERLAY RxgkIntPfnUpdateOverlay;
    PDXGADAPTER_SETQUEUEDLIMIT RxgkIntPfnSetQueuedLimit;
    PDXGADAPTER_SETGAMMARAMP RxgkIntPfnSetGammaRamp;
    PDXGADAPTER_SETDISPLAYMODE RxgkIntPfnSetDisplayMode;
    PDXGADAPTER_SETDISPLAYPRIVATEDRIVERFORMAT RxgkIntPfnSetDisplayPrivateDriverFormat;
    PDXGADAPTER_UNLOCK RxgkIntPfnUnlock;
} REACTOS_WIN32K_DXGKRNL_INTERFACE, *PREACTOS_WIN32K_DXGKRNL_INTERFACE;
